<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户认证与权限管理类图</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/9.4.0/mermaid.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mermaid/9.4.0/mermaid.min.css">
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f5f5f5;
            margin: 0;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .container {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
            margin-bottom: 20px;
            max-width: 1100px;
            width: 100%;
        }
        h1 {
            color: #2c3e50;
            text-align: center;
            margin-bottom: 30px;
        }
        .mermaid {
            margin: 30px 0;
            display: flex;
            justify-content: center;
        }
        .mermaid svg {
            max-width: 100%;
            height: auto;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>用户认证与权限管理类图</h1>
        <div class="mermaid">
            classDiagram
                class User {
                    +Long id
                    +String username
                    +String password
                    +String email
                    +String phone
                    +Role role
                    +List~Permission~ permissions
                    +createTime
                    +updateTime
                    +getPermissions()
                    +setPermissions()
                    +hasPermission()
                }
                
                class Role {
                    +Long id
                    +String name
                    +String description
                    +List~Permission~ permissions
                    +getPermissions()
                    +setPermissions()
                }
                
                class Permission {
                    +Long id
                    +String name
                    +String description
                    +String code
                    +getCode()
                    +setCode()
                }
                
                class AuthController {
                    +login()
                    +register()
                    +refreshToken()
                    +logout()
                }
                
                class JwtTokenProvider {
                    +String generateToken()
                    +boolean validateToken()
                    +String getUsernameFromToken()
                }
                
                class SecurityConfig {
                    +configure()
                    +passwordEncoder()
                    +jwtAuthenticationFilter()
                }
                
                class JwtAuthenticationFilter {
                    +doFilterInternal()
                    +getJwtFromRequest()
                }
                
                User "1" *-- "N" Role : has
                Role "1" *-- "N" Permission : has
                User "1" *-- "N" Permission : has
                AuthController --> JwtTokenProvider : uses
                SecurityConfig --> JwtAuthenticationFilter : configures
                JwtAuthenticationFilter --> JwtTokenProvider : uses
        </div>
    </div>
    <script>
        mermaid.initialize({
            theme: 'default',
            startOnLoad: true,
            securityLevel: 'loose'
        });
    </script>
</body>
</html> 